// var o;
// exports.CurrencyData = exports.CurrencyType = void 0;
// var r;
// var a;
// var $storageClass = require("../../resources/scripts/AL_Framework_Storage_Class");
// var AL_GAME_HUA_Common = require("./AL_GAME_HUA_Common");
// var AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
// var AL_GAME_HUA_EventConfig = require("./AL_GAME_HUA_EventConfig");
// var AL_GAME_HUA_GameConst = require("./AL_GAME_HUA_GameConst");
// var AL_GAME_HUA_GoodsConfig = require("./AL_GAME_HUA_GoodsConfig");
// var d = (function () {
//     function e(e, t) {
//         this.have = 0;
//         this.have = e;
//         this.chuli_zhuangtai_gaibian = t;
//     }
//     e.prototype.jiancha_huobi_shifou_zugou = function (e) {
//         return this.have >= e;
//     };
//     e.prototype.use = function (e) {
//         this.have = Math.max(0, this.have - e);
//         if (this.onUse) {
//             this.onUse(e, this.have);
//         }
//         if (this.chuli_zhuangtai_gaibian) {
//             this.chuli_zhuangtai_gaibian(-e, this.have);
//         }
//     };
//     e.prototype.add = function (e) {
//         this.have += e;
//         if (this.onAdd) {
//             this.onAdd(e, this.have);
//         }
//         if (this.chuli_zhuangtai_gaibian) {
//             this.chuli_zhuangtai_gaibian(e, this.have);
//         }
//     };
//     return e;
// })();
// (a = r = exports.CurrencyType || (exports.CurrencyType = {}))[(a.COIN = 0)] = "COIN";
// a[(a.VIT = 1)] = "VIT";
// var h = {
//     vit: 5,
//     vitRecoverTime: -1
// };
// var _ = (function (e) {
//     function t() {
//         return (null !== e && e.apply(this, arguments)) || this;
//     }
//     __extends(t, e);
//     t.getInstance = function () {
//         return AL_APP_SDK_MANAGER.localManager.huoqu_cunchu_lei(t);
//     };
//     Object.defineProperty(t.prototype, "coin", {
//         get: function () {
//             return Number(localStorage.getItem(ailin.Key_Gold)) || 0;
//         },
//         set: function (e) {
//             if (!("number" != typeof e || isNaN(e))) {
//                 localStorage.setItem(ailin.Key_Gold, String(e));
//                 if (ailin_sdk_manager.baocunYouxiShuju) {
//                     ailin_sdk_manager.baocunYouxiShuju(ailin.Key_Gold, String(e));
//                 }
//             }
//         },
//         enumerable: !1,
//         configurable: !0
//     });
//     t.prototype.zhixing_chushihua_chuli = function () {
//         var e = this;
//         h.vit = AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max;
//         this.chushihua_cunchu_shuju(h);
//         this.chushihua_yuancheng_key(Object.keys(h));
//         this.coinObj = new d(this.coin, function (t, n) {
//             e.coin = n;
//             AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_COIN_CHANGE, e.coin);
//         });
//         this.vitObj = new d(this.vit, function (t, n) {
//             e.vit = n;
//             AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_VIT_CHANGE, e.vit);
//         });
//         this.vitObj.onUse = function () {
//             if (-1 == e.vitRecoverTime) {
//                 e.vitRecoverTime = Date.now();
//             }
//         };
//         this.vitObj.onAdd = function (t, n) {
//             if (n == AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max) {
//                 e.vitRecoverTime = -1;
//             }
//         };
//         this.jiancha_tili_zhi();
//     };
//     t.prototype.huoqu_huobi_caozuo_duixiang = function (e) {
//         switch (e) {
//             case r.COIN:
//                 return this.coinObj;
//             case r.VIT:
//                 return this.vitObj;
//         }
//         return null;
//     };
//     t.prototype.getHave = function (e) {
//         return this.huoqu_huobi_caozuo_duixiang(e).have;
//     };
//     t.prototype.jiancha_huobi_shifou_zugou = function (e) {
//         return this.huoqu_huobi_caozuo_duixiang(e.type).jiancha_huobi_shifou_zugou(e.num);
//     };
//     t.prototype.huoqu_queshao_de_huobi = function (e) {
//         var t = this.huoqu_huobi_caozuo_duixiang(e.type);
//         var n = e.num - t.have;
//         return {
//             type: e.type,
//             num: n
//         };
//     };
//     t.prototype.tianjia_huobi = function (e) {
//         this.huoqu_huobi_caozuo_duixiang(e.type).add(e.num);
//     };
//     t.prototype.shiyong_huobi = function (e, t) {
//         if (void 0 === t) {
//             t = !1;
//         }
//         if (!t) {
//             var n = this.huoqu_queshao_de_huobi(e);
//             if (n.num > 0) {
//                 return {
//                     result: !1,
//                     lack: n
//                 };
//             }
//         }
//         this.huoqu_huobi_caozuo_duixiang(e.type).use(e.num);
//         return {
//             result: !0
//         };
//     };
//     t.prototype.jiancha_tili_zhi = function (e) {
//         var t = null != e ? e : AL_GAME_HUA_Common.Common.huoqu_dangqian_shijian();
//         if (this.vitObj.have < AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max) {
//             var n = t - this.vitRecoverTime;
//             var o = Math.floor(n / 1e3 / AL_GAME_HUA_GameConst.GameConst.getInstance().vit_recovery_time);
//             if (o > 0) {
//                 var i = this.vit;
//                 var r = Math.min(AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max, this.vit + o) - i;
//                 this.vitObj.add(r);
//                 if (r > 0) {
//                     AL_GAME_HUA_EventConfig.EventConfig.getInstance().assetsReportOutput({
//                         source: AL_GAME_HUA_EventConfig.AssetsSource.game,
//                         action: AL_GAME_HUA_EventConfig.AssetsAction.get,
//                         goodsList: [
//                             {
//                                 goods: AL_GAME_HUA_GoodsConfig.GoodsId.vit,
//                                 num: r
//                             }
//                         ]
//                     });
//                 }
//                 this.vitRecoverTime =
//                     this.vitRecoverTime + 1e3 * o * AL_GAME_HUA_GameConst.GameConst.getInstance().vit_recovery_time;
//                 if (this.vitObj.have == AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max) {
//                     this.vitRecoverTime = -1;
//                     return {
//                         value: 0,
//                         progress: 1
//                     };
//                 }
//             }
//             return {
//                 value: 1e3 * AL_GAME_HUA_GameConst.GameConst.getInstance().vit_recovery_time - (t - this.vitRecoverTime),
//                 progress:
//                     (t - this.vitRecoverTime) / (1e3 * AL_GAME_HUA_GameConst.GameConst.getInstance().vit_recovery_time)
//             };
//         }
//         return {
//             value: 0,
//             progress: 1
//         };
//     };
//     t.bundle = AL_GAME_HUA_Define.Define.GAME_NAME;
//     t.key = "_d";
//     return t;
// })($storageClass.AL_Framework_Storage_Class);
// exports.CurrencyData = _;



// /** 货币类型枚举 */
// var currencyTypeEnum, currencyEnumInstance, storageClass = require("../../resources/scripts/AL_Framework_Storage_Class");
// var AL_GAME_HUA_Common = require("./AL_GAME_HUA_Common");
// var AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
// var AL_GAME_HUA_EventConfig = require("./AL_GAME_HUA_EventConfig");
// var AL_GAME_HUA_GameConst = require("./AL_GAME_HUA_GameConst");
// var AL_GAME_HUA_GoodsConfig = require("./AL_GAME_HUA_GoodsConfig");

// /** 货币操作类 */
// var CurrencyOperation = (function () {
//     /**
//      * @param {number} initialAmount 初始数量
//      * @param {Function} onChangeCallback 变化回调
//      */
//     function CurrencyOperation(initialAmount, onChangeCallback) {
//         this.amount = 0;
//         this.amount = initialAmount;
//         this.chuli_zhuangtai_gaibian = onChangeCallback;
//     }

//     /**
//      * 验证是否足够
//      * @param {number} requiredAmount 所需数量
//      * @returns {boolean}
//      */
//     CurrencyOperation.prototype.jiancha_huobi_shifou_zugou = function (requiredAmount) {
//         return this.amount >= requiredAmount;
//     };

//     /**
//      * 使用货币
//      * @param {number} usedAmount 使用数量
//      */
//     CurrencyOperation.prototype.use = function (usedAmount) {
//         this.amount = Math.max(0, this.amount - usedAmount);
//         if (this.onUse) {
//             this.onUse(usedAmount, this.amount);
//         }
//         if (this.chuli_zhuangtai_gaibian) {
//             this.chuli_zhuangtai_gaibian(-usedAmount, this.amount);
//         }
//     };

//     /**
//      * 增加货币
//      * @param {number} addedAmount 增加数量
//      */
//     CurrencyOperation.prototype.add = function (addedAmount) {
//         this.amount += addedAmount;
//         if (this.onAdd) {
//             this.onAdd(addedAmount, this.amount);
//         }
//         if (this.chuli_zhuangtai_gaibian) {
//             this.chuli_zhuangtai_gaibian(addedAmount, this.amount);
//         }
//     };

//     return CurrencyOperation;
// })();

// /** 货币类型 */
// (currencyEnumInstance = currencyTypeEnum = exports.CurrencyType || (exports.CurrencyType = {}))[currencyEnumInstance.COIN = 0] = "COIN";
// currencyEnumInstance[currencyEnumInstance.VIT = 1] = "VIT";

// /** 体力配置 */
// var vitConfig = {
//     vit: 5,
//     vitRecoverTime: -1
// };

// /** 货币数据类 */
// var CurrencyDataClass = (function (BaseClass) {
//     /**
//      * 
//      */
//     function CurrencyDataClass() {
//         return (null !== BaseClass && BaseClass.apply(this, arguments)) || this;
//     }

//     __extends(CurrencyDataClass, BaseClass);

//     /**
//      * 获取实例
//      * @returns {CurrencyDataClass}
//      */
//     CurrencyDataClass.getInstance = function () {
//         return AL_APP_SDK_MANAGER.localManager.huoqu_cunchu_lei(CurrencyDataClass);
//     };

//     Object.defineProperty(CurrencyDataClass.prototype, "coin", {
//         /**
//          * 获取金币
//          * @returns {number}
//          */
//         get: function () {
//             return Number(localStorage.getItem(ailin.Key_Gold)) || 0;
//         },
//         /**
//          * 设置金币
//          * @param {number} value 数值
//          */
//         set: function (value) {
//             if (typeof value !== "number" || isNaN(value)) {
//                 return;  // 这里增加了对非法输入的检测，防止错误的数据导致错误行为
//             }
//             localStorage.setItem(ailin.Key_Gold, String(value));
//             if (ailin_sdk_manager.baocunYouxiShuju) {
//                 ailin_sdk_manager.baocunYouxiShuju(ailin.Key_Gold, String(value));
//             }
//         },
//         enumerable: !1,
//         configurable: !0
//     });

//     /**
//      * 初始化
//      */
//     CurrencyDataClass.prototype.zhixing_chushihua_chuli = function () {
//         var selfInstance = this;
//         vitConfig.vit = AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max;
//         this.chushihua_cunchu_shuju(vitConfig);
//         this.chushihua_yuancheng_key(Object.keys(vitConfig));
//         this.coinObj = new CurrencyOperation(this.coin, function (changeAmount, newAmount) {
//             selfInstance.coin = newAmount;
//             AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_COIN_CHANGE, selfInstance.coin);
//         });
//         this.vitObj = new CurrencyOperation(this.vit, function (changeAmount, newAmount) {
//             selfInstance.vit = newAmount;
//             AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_VIT_CHANGE, selfInstance.vit);
//         });
//         this.vitObj.onUse = function () {
//             if (selfInstance.vitRecoverTime === -1) {
//                 selfInstance.vitRecoverTime = Date.now();
//             }
//         };
//         this.vitObj.onAdd = function (addedAmount, newAmount) {
//             if (newAmount === AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max) {
//                 selfInstance.vitRecoverTime = -1;
//             }
//         };

//         this.jiancha_tili_zhi();
//     };

//     /**
//      * 获取货币操作对象
//      * @param {currencyTypeEnum} currencyType 货币类型
//      * @returns {CurrencyOperation | null}
//      */
//     CurrencyDataClass.prototype.huoqu_huobi_caozuo_duixiang = function (currencyType) {
//         switch (currencyType) {
//             case currencyTypeEnum.COIN:
//                 return this.coinObj;
//             case currencyTypeEnum.VIT:
//                 return this.vitObj;
//         }
//         return null;
//     };

//     /**
//      * 获取货币数量
//      * @param {currencyTypeEnum} currencyType 货币类型
//      * @returns {number}
//      */
//     CurrencyDataClass.prototype.getHave = function (currencyType) {
//         return this.huoqu_huobi_caozuo_duixiang(currencyType).amount;
//     };

//     /**
//      * 检查货币是否足够
//      * @param {Object} currencyObject 货币对象
//      * @returns {boolean}
//      */
//     CurrencyDataClass.prototype.jiancha_huobi_shifou_zugou = function (currencyObject) {
//         return this.huoqu_huobi_caozuo_duixiang(currencyObject.type).jiancha_huobi_shifou_zugou(currencyObject.num);
//     };

//     /**
//      * 获取缺少的货币
//      * @param {Object} currencyObject 货币对象
//      * @returns {Object}
//      */
//     CurrencyDataClass.prototype.huoqu_queshao_de_huobi = function (currencyObject) {
//         var currencyOp = this.huoqu_huobi_caozuo_duixiang(currencyObject.type);
//         var deficitAmount = currencyObject.num - currencyOp.amount;
//         return {
//             type: currencyObject.type,
//             num: deficitAmount
//         };
//     };

//     /**
//      * 添加货币
//      * @param {Object} currencyObject 货币对象
//      */
//     CurrencyDataClass.prototype.tianjia_huobi = function (currencyObject) {
//         this.huoqu_huobi_caozuo_duixiang(currencyObject.type).add(currencyObject.num);
//     };

//     /**
//      * 使用货币
//      * @param {Object} currencyObject 货币对象
//      * @param {boolean} ignoreLack 忽略缺少
//      * @returns {Object}
//      */
//     CurrencyDataClass.prototype.shiyong_huobi = function (currencyObject, ignoreLack) {
//         if (ignoreLack === undefined) {
//             ignoreLack = false;
//         }
//         if (!ignoreLack) {
//             var lackInfo = this.huoqu_queshao_de_huobi(currencyObject);
//             if (lackInfo.num > 0) {
//                 return {
//                     result: false,
//                     lack: lackInfo
//                 };
//             }
//         }
//         this.huoqu_huobi_caozuo_duixiang(currencyObject.type).use(currencyObject.num);
//         return {
//             result: true
//         };
//     };

//     /**
//      * 检查体力
//      * @param {number} currentTime 当前时间
//      * @returns {Object}
//      */
//     CurrencyDataClass.prototype.jiancha_tili_zhi = function (currentTime) {
//         var currentTimestamp = currentTime || AL_GAME_HUA_Common.Common.huoqu_dangqian_shijian();
//         if (this.vitObj.amount < AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max) {
//             var timeElapsed = currentTimestamp - this.vitRecoverTime;
//             var vitRecovered = Math.floor(timeElapsed / 1000 / AL_GAME_HUA_GameConst.GameConst.getInstance().vit_recovery_time);
//             if (vitRecovered > 0) {
//                 var previousVit = this.vit;
//                 var actualRecovery = Math.min(AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max, this.vit + vitRecovered) - previousVit;
//                 this.vitObj.add(actualRecovery);
//                 if (actualRecovery > 0) {
//                     AL_GAME_HUA_EventConfig.EventConfig.getInstance().assetsReportOutput({
//                         source: AL_GAME_HUA_EventConfig.AssetsSource.game,
//                         action: AL_GAME_HUA_EventConfig.AssetsAction.get,
//                         goodsList: [
//                             {
//                                 goods: AL_GAME_HUA_GoodsConfig.GoodsId.vit,
//                                 num: actualRecovery
//                             }
//                         ]
//                     });
//                 }
//                 this.vitRecoverTime = this.vitRecoverTime + 1000 * vitRecovered * AL_GAME_HUA_GameConst.GameConst.getInstance().vit_recovery_time;
//                 if (this.vitObj.amount === AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max) {
//                     this.vitRecoverTime = -1;
//                     return {
//                         value: 0,
//                         progress: 1
//                     };
//                 }
//             }
//             return {
//                 value: 1000 * AL_GAME_HUA_GameConst.GameConst.getInstance().vit_recovery_time - (currentTimestamp - this.vitRecoverTime),
//                 progress: (currentTimestamp - this.vitRecoverTime) / (1000 * AL_GAME_HUA_GameConst.GameConst.getInstance().vit_recovery_time)
//             };
//         }
//         return {
//             value: 0,
//             progress: 1
//         };
//     };

//     CurrencyDataClass.bundle = AL_GAME_HUA_Define.Define.GAME_NAME;
//     CurrencyDataClass.key = "_d";
//     return CurrencyDataClass;
// })(storageClass.AL_Framework_Storage_Class);

// exports.CurrencyData = CurrencyDataClass;




const storageClass = require("../../resources/scripts/AL_Framework_Storage_Class");
const AL_GAME_HUA_Common = require("./AL_GAME_HUA_Common");
const AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
const AL_GAME_HUA_EventConfig = require("./AL_GAME_HUA_EventConfig");
const AL_GAME_HUA_GameConst = require("./AL_GAME_HUA_GameConst");
const AL_GAME_HUA_GoodsConfig = require("./AL_GAME_HUA_GoodsConfig");

/**
 * @enum {number} currencyTypeEnum
 * 货币类型枚举
 */
const currencyTypeEnum = {
    COIN: 0,
    VIT: 1
};

exports.CurrencyType = currencyTypeEnum

/**
 * @constant {Object} vitConfig
 * 体力配置
 */
const vitConfig = {
    vit: 5,
    vitRecoverTime: -1
};

/**
 * @class CurrencyOperation
 * 货币操作类
 */
class CurrencyOperation {
    /**
     * @param {number} initialAmount 初始数量
     * @param {Function} onChangeCallback 变化回调
     */
    constructor(initialAmount, onChangeCallback) {
        this.amount = initialAmount || 0;
        this.onChange = onChangeCallback;
    }

    /**
     * 验证是否足够
     * @param {number} requiredAmount 所需数量
     * @returns {boolean}
     */
    jiancha_huobi_shifou_zugou(requiredAmount) {
        return this.amount >= requiredAmount;
    }

    /**
     * 使用货币
     * @param {number} usedAmount 使用数量
     */
    use(usedAmount) {
        this.amount = Math.max(0, this.amount - usedAmount);
        if (this.onUse) {
            this.onUse(usedAmount, this.amount);
        }
        if (this.onChange) {
            this.onChange(-usedAmount, this.amount);
        }
    }

    /**
     * 增加货币
     * @param {number} addedAmount 增加数量
     */
    add(addedAmount) {
        this.amount += addedAmount;
        if (this.onAdd) {
            this.onAdd(addedAmount, this.amount);
        }
        if (this.onChange) {
            this.onChange(addedAmount, this.amount);
        }
    }
}

/**
 * @class CurrencyDataClass
 * @extends {storageClass.AL_Framework_Storage_Class}
 * 货币数据类
 */
class CurrencyDataClass extends storageClass.AL_Framework_Storage_Class {
    /**
     * 获取实例
     * @returns {CurrencyDataClass}
     */
    static getInstance() {
        return AL_APP_SDK_MANAGER.localManager.huoqu_cunchu_lei(CurrencyDataClass);
    }

    /** @type {number} */
    get coin() {
        return Number(localStorage.getItem(ailin.Key_Gold)) || 0;
    }

    set coin(value) {
        if (typeof value !== "number" || isNaN(value)) {
            return; // 防止非法输入
        }
        localStorage.setItem(ailin.Key_Gold, String(value));
        if (ailin_sdk_manager.baocunYouxiShuju) {
            ailin_sdk_manager.baocunYouxiShuju(ailin.Key_Gold, String(value));
        }
    }

    /**
     * 初始化
     */
    zhixing_chushihua_chuli() {
        vitConfig.vit = AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max;
        this.chushihua_cunchu_shuju(vitConfig);
        this.chushihua_yuancheng_key(Object.keys(vitConfig));

        this.coinObj = new CurrencyOperation(this.coin, (changeAmount, newAmount) => {
            this.coin = newAmount;
            AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_COIN_CHANGE, this.coin);
        });

        this.vitObj = new CurrencyOperation(this.vit, (changeAmount, newAmount) => {
            this.vit = newAmount;
            AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_VIT_CHANGE, this.vit);
        });

        this.vitObj.onUse = () => {
            if (this.vitRecoverTime === -1) {
                this.vitRecoverTime = Date.now();
            }
        };

        this.vitObj.onAdd = (addedAmount, newAmount) => {
            if (newAmount === AL_GAME_HUA_GameConst.GameConst.getInstance().vit_max) {
                this.vitRecoverTime = -1;
            }
        };

        this.jiancha_tili_zhi();
    }

    /**
     * 获取货币操作对象
     * @param {currencyTypeEnum} currencyType 货币类型
     * @returns {CurrencyOperation | null}
     */
    huoqu_huobi_caozuo_duixiang(currencyType) {
        switch (currencyType) {
            case currencyTypeEnum.COIN:
                return this.coinObj;
            case currencyTypeEnum.VIT:
                return this.vitObj;
            default:
                return null;
        }
    }

    /**
     * 获取货币数量
     * @param {currencyTypeEnum} currencyType 货币类型
     * @returns {number}
     */
    getHave(currencyType) {
        const currencyOp = this.huoqu_huobi_caozuo_duixiang(currencyType);
        return currencyOp ? currencyOp.amount : 0;
    }

    /**
     * 检查货币是否足够
     * @param {Object} currencyObject 货币对象
     * @returns {boolean}
     */
    jiancha_huobi_shifou_zugou(currencyObject) {
        const currencyOp = this.huoqu_huobi_caozuo_duixiang(currencyObject.type);
        return currencyOp ? currencyOp.jiancha_huobi_shifou_zugou(currencyObject.num) : false;
    }

    /**
     * 获取缺少的货币
     * @param {Object} currencyObject 货币对象
     * @returns {Object}
     */
    huoqu_queshao_de_huobi(currencyObject) {
        const currencyOp = this.huoqu_huobi_caozuo_duixiang(currencyObject.type);
        const deficitAmount = currencyObject.num - (currencyOp ? currencyOp.amount : 0);
        return {
            type: currencyObject.type,
            num: deficitAmount
        };
    }

    /**
     * 添加货币
     * @param {Object} currencyObject 货币对象
     */
    tianjia_huobi(currencyObject) {
        const currencyOp = this.huoqu_huobi_caozuo_duixiang(currencyObject.type);
        if (currencyOp) {
            currencyOp.add(currencyObject.num);
        }
    }

    /**
     * 使用货币
     * @param {Object} currencyObject 货币对象
     * @param {boolean} ignoreLack 忽略缺少
     * @returns {Object}
     */
    shiyong_huobi(currencyObject, ignoreLack = false) {
        if (!ignoreLack) {
            const lackInfo = this.huoqu_queshao_de_huobi(currencyObject);
            if (lackInfo.num > 0) {
                return {
                    result: false,
                    lack: lackInfo
                };
            }
        }
        const currencyOp = this.huoqu_huobi_caozuo_duixiang(currencyObject.type);
        if (currencyOp) {
            currencyOp.use(currencyObject.num);
        }
        return {
            result: true
        };
    }

    /**
     * 检查体力
     * @param {number} [currentTime] 当前时间
     * @returns {Object}
     */
    jiancha_tili_zhi(currentTime) {
        const currentTimestamp = currentTime || AL_GAME_HUA_Common.Common.huoqu_dangqian_shijian();
        const gameConst = AL_GAME_HUA_GameConst.GameConst.getInstance();

        if (this.vitObj.amount < gameConst.vit_max) {
            const timeElapsed = currentTimestamp - this.vitRecoverTime;
            const vitRecovered = Math.floor(timeElapsed / 1000 / gameConst.vit_recovery_time);

            if (vitRecovered > 0) {
                const previousVit = this.vitObj.amount;
                const actualRecovery = Math.min(gameConst.vit_max, previousVit + vitRecovered) - previousVit;

                this.vitObj.add(actualRecovery);

                if (actualRecovery > 0) {
                    AL_GAME_HUA_EventConfig.EventConfig.getInstance().assetsReportOutput({
                        source: AL_GAME_HUA_EventConfig.AssetsSource.game,
                        action: AL_GAME_HUA_EventConfig.AssetsAction.get,
                        goodsList: [
                            {
                                goods: AL_GAME_HUA_GoodsConfig.GoodsId.vit,
                                num: actualRecovery
                            }
                        ]
                    });
                }

                this.vitRecoverTime += vitRecovered * 1000 * gameConst.vit_recovery_time;

                if (this.vitObj.amount === gameConst.vit_max) {
                    this.vitRecoverTime = -1;
                    return {
                        value: 0,
                        progress: 1
                    };
                }
            }

            return {
                value: gameConst.vit_recovery_time * 1000 - (currentTimestamp - this.vitRecoverTime),
                progress: (currentTimestamp - this.vitRecoverTime) / (gameConst.vit_recovery_time * 1000)
            };
        }

        return {
            value: 0,
            progress: 1
        };
    }
}

// 设置类的全局标识
CurrencyDataClass.bundle = AL_GAME_HUA_Define.Define.GAME_NAME;
CurrencyDataClass.key = "_d";

exports.CurrencyData = CurrencyDataClass;
